package com.spring.demo.corp.handler;

import com.spring.demo.corp.PayOrderForm;
import com.spring.demo.corp.PayOrderService;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.Objects;

@Order(1)
@Component
public class ParamsPayOrderChainFilter implements PayOrderService {

    @Override
    public boolean payOrder(PayOrderForm payOrderForm) {
        if (StringUtils.isEmpty(payOrderForm.getOrderId())) {
            System.out.println("订单ID不能为空");
            return false;
        }
        if (Objects.isNull(payOrderForm.getAmount())) {
            System.out.println("金额不能为空");
            return false;
        }
        return true;
    }

}
